package com.bestv.db;

import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by charle-chen on 15/11/26.
 */
public class DbHelper {
    public static void executeBatch(DbEntity dbEntity,String[] sqls){
        try {
            Statement st = dbEntity.getConn().createStatement();
            for(int i=0;i<sqls.length;i++){
                st.addBatch(sqls[i]);
            }
            st.executeBatch();

        }catch (SQLException e){
            e.printStackTrace();
            dbEntity.closeDb();
        }
    }

    public static void closeDb(DbEntity dbEntity){
        dbEntity.closeDb();
    }
}
